package com.linwen.excise.leetcode;

/**
 * @ClassName _1470重新排列数组
 * @Description TODO
 * @Author zero
 * @DATE 2024/9/22 2:51 AM
 * @Version 1.0
 */
public class _1470重新排列数组 {
    public static void main(String[] args) {
        _1470重新排列数组 inst = new _1470重新排列数组();
        int[] nums = {2,5,1,3,4,7};
        int n = 3;
        System.out.println(inst.shuffle(nums, n));
    }
    public int[] shuffle(int[] nums, int n) {
        int[] res = new int[nums.length];
        int index = 0;
        for (int i = 0; i < n; i++) {
            res[index++] = nums[i];
            res[index++] = nums[i+n];
        }
        return res;
    }
}
